//
//  SSEmoticonBtn.swift
//  weibo
//
//  Created by 邵帅 on 16/7/3.
//  Copyright © 2016年 groupNineObject. All rights reserved.
//

import UIKit

class SSEmoticonBtn: UIButton {

    var emoticonButton: SSEmoticon? {
        
        
        didSet {
            
            
            if let png = emoticonButton?.png,path = emoticonButton?.path {
                
                let imageName = "\(path)/\(png)"
                
                self.setImage(UIImage(named: imageName), forState: .Normal)
                
                
                
            }else {
                
                self.setImage(nil, forState: .Normal)
            }
            
            if let emoji = emoticonButton?.emoji {
                
                // emoji
                self.setTitle(emoji, forState: UIControlState.Normal)
                
                
            } else {
                
                // 还是由于cell的重用
                self.setTitle(nil, forState: UIControlState.Normal)
            }

            
        }
        
    }

}
